odhcpd: fix captive_portal_uri reset
authorDavid Härdeman <[email protected]>
Fri, 12 Dec 2025 21:46:31 +0000 (22:46 +0100)
committerÁlvaro Fernández Rojas <[email protected]>
Sat, 13 Dec 2025 10:43:52 +0000 (11:43 +0100)
commitcf51aeb93220672d54d0d0f3707710bf544801e2
treeec4b9356f7778666ca14810af3b27319d7245e4b
parente8b7fdea8d5e39c263514204642865c195a3294f
odhcpd: fix captive_portal_uri reset

odhcpd_reload() calls clean_interface() which does a memset() on the
given struct iface from iface->ra onwards, so captive_portal_uri and
captive_portal_uri_len have to be below iface->ra in order to be zeroed
on reload.

Otherwise, iface->captive_portal_uri will be free():d, but
iface->captive_portal_uri_len could still be > 0.

This is a bit of a footgun (one wouldn't normally expect the order of
struct members to matter), and should probably be dealt with in a more
thorough manner, but I've just done the minimum and added a warning in
src/odhcpd.h for now,

Signed-off-by: David Härdeman <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/345
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/odhcpd.h